Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: try to decode hex encoded md5 hash during pw migration #4287

Closed
wants to merge 1 commit into from

Conversation

jonas-jonas
Copy link
Member

@jonas-jonas jonas-jonas commented Feb 3, 2025

We're passing the byte value encoded as base64 directly, e.g. base64(md5("password")), to the comparison function. Some people would expect, that the value of md5("password") is hex encoded before it is encoded as base64, e.g. base64(hex(md5("password").

AFAICT, PHP's md5 function implements the hex based approach, which is where the confusion is coming from, I assume. Other implementations seem to be generating the hash without first encoding the md5 digest as hex.

Related issue(s)

Closes #3310

Checklist

  • I have read the contributing guidelines.
  • I have referenced an issue containing the design document if my change
    introduces a new feature.
  • I am following the
    contributing code guidelines.
  • I have read the security policy.
  • I confirm that this pull request does not address a security
    vulnerability. If this pull request addresses a security vulnerability, I
    confirm that I got the approval (please contact
    [email protected]) from the maintainers to push
    the changes.
  • I have added tests that prove my fix is effective or that my feature
    works.
  • I have added or changed the documentation.

Further Comments

@jonas-jonas jonas-jonas requested review from aeneasr and a team as code owners February 3, 2025 10:31
@jonas-jonas jonas-jonas self-assigned this Feb 3, 2025
}

// The hash is a hex encoded string, so we return the decoded hash.
return nil, nil, passedHash, nil
case 5:
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if this needs to be done in the salted version of this hash as well. I am not familiar with that format at all, and not sure what applications would generate this form.

Copy link

codecov bot commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.57%. Comparing base (119841a) to head (d78f7b7).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
hash/hash_comparator.go 66.66% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4287      +/-   ##
==========================================
- Coverage   78.58%   78.57%   -0.01%     
==========================================
  Files         381      381              
  Lines       27370    27375       +5     
==========================================
+ Hits        21509    21511       +2     
- Misses       4238     4241       +3     
  Partials     1623     1623              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@jonas-jonas
Copy link
Member Author

See #3310 (comment)

@jonas-jonas jonas-jonas closed this Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unable to login using the imported MD5 identity.
1 participant